﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace TestProject
{
    
    
    /// <summary>
    ///This is a test class for XmlRendererTest and is intended
    ///to contain all XmlRendererTest Unit Tests
    ///</summary>
    [TestClass()]
    public class XmlRendererTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Transform
        ///</summary>
        [TestMethod()]
        public void TransformTest()
        {
            string xmlString = "<?xml version='1.0' encoding='utf-8'?><article xmlns='http://docbook.org/ns/docbook' version='5.0' xml:lang='en'><title>Sample article</title><para>This is a very short article.</para></article>";
            string expected = "<html>\r\n\t<head>\r\n\t\t<title>Sample article</title>\r\n\t\t<meta name=\"generator\" content=\"DocBook XSL Stylesheets V1.76.0\" />\r\n\t</head>\r\n\t<body bgcolor=\"white\" text=\"black\" link=\"#0000FF\" vlink=\"#840084\" alink=\"#0000FF\">\r\n\t\t<div lang=\"en\" class=\"article\" title=\"Sample article\">\r\n\t\t\t<div class=\"titlepage\">\r\n\t\t\t\t<div>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<h2 class=\"title\">"; 
            //string xsltPath = @"C:\Users\Slava.Barouline\Documents\Visual Studio 2010\Projects\parl2\XmlRenderer\html\docbook.xsl";
            string actual = XmlRenderer.Transform(xmlString);
            Assert.IsTrue(actual.StartsWith(expected));
        }
    }
}
